package Servidor.Modelo;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

/**
 *
 * @author Angel Lopez
 */
public class Property {
    
    private static Property instancia = new Property();
    private static Properties prop = null;
    private boolean load = true;
    private String ip_server = "";
    private int port = -1;
    private String type_db = "";
    private String conexion = "";
    private String user = "";
    private String pass = "";
    
    private Property(){
        prop = new Properties();
        try{
             prop.load(new FileInputStream("config.properties"));
        } catch (IOException e) {
            load = false;
            System.out.println("NO SE HA PODIDO CARGAR EL FICHERO PROPERTIES");
        }
        
        System.out.println("PROPIEDADES : "+ prop.getProperty("ip_server"));
        ip_server = prop.getProperty("ip_server");
        String portString = prop.getProperty("port");
        port = Integer.parseInt(portString);
        
        type_db = prop.getProperty("type_db");
        conexion = prop.getProperty("conexion");
        user = prop.getProperty("user");
        pass = prop.getProperty("pass");
    }
    
    /**
     * @return instancia
     */
    public static Property getInstance(){
        return instancia;
    }
    
    public boolean is_load(){
        return load;
    }
    
        public String getConexion() {
        return conexion;
    }

    public String getIp_server() {
        return ip_server;
    }

    public String getPass() {
        return pass;
    }

    public static Properties getProp() {
        return prop;
    }

    public int getPort() {
        return port;
    }

    public String getUser() {
        return user;
    }
    
    
    
}
